package com.nameli.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nameli.SIM.bean.entity.StudentInfo;

import com.nameli.SIM.bean.query.StudentQuery;
import com.nameli.SIM.bean.vo.StudentVO;
import com.nameli.SIM.mapper.StudentInfoMapper;
import com.nameli.admin.service.StudentService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author NAME-L
 * @Description TODO
 * @className StudentServiceImpl
 * @date 2021-10-31 16:32:29
 */
@Component
@Transactional(rollbackFor = {Exception.class}, timeout = 3)
public class StudentServiceImpl implements StudentService {
    private static final Log log = LogFactory.getLog(StudentServiceImpl.class);

    @Autowired
    private StudentInfoMapper studentInfoMapper;


    @Override
    public PageInfo<StudentVO> queryAllMajor(Integer pageIndex, Integer pageSize) {
        PageHelper.startPage(pageIndex, pageSize);
        List<StudentVO> studentVOS = studentInfoMapper.queryAll();
        PageInfo<StudentVO> pageInfo = new PageInfo<>(studentVOS);
        return pageInfo;
    }

    @Override
    public Boolean updateStudentInfo(StudentInfo studentInfo) {
        return null;
    }

    @Override
    public PageInfo<StudentVO> queryByCondition(StudentQuery studentQuery , Integer pageIndex , Integer pageSize) {
        PageHelper.startPage(pageIndex, pageSize);
        List<StudentVO> studentVOS = studentInfoMapper.queryByCondition(studentQuery);
        PageInfo<StudentVO> pageInfo = new PageInfo<>(studentVOS);
        return pageInfo;
    }
}
